(function(){
    // 1、动态添加banner的背景图
    bannerBackgroundImg();
    // 2、动态添加banner的示例图函数
    bannerImg();
    // 3、动态添加icon
    addIcon();
    // 轮播图效果
    function myMove(){
        var ads1Li = getElementsByClassName('ads1-img')[0];
        var timer = null;
        setInterval(function(){
            var left =  ads1Li.offsetleft - 520;
            ads1Li.left = left + 'px'
        },300)
    }
})()



   // 1、动态添加banner的背景图函数
function bannerBackgroundImg(){
    var bannerW = $('banner_ul')    
    var allLi = bannerW.getElementsByClassName('banner-content')
    for(var i = 0;i<allLi.length;i++){
        var li = allLi[i]; 
        li.style.background = "url('images/banner" + (i+2) + ".png')"
    }
}
   // 2、动态添加banner的示例图函数
   function bannerImg(){
    var bannerW = $('banner_ul')    
    var allLi = bannerW.getElementsByClassName('banner-img')
    for(var i = 0;i<allLi.length;i++){
        var li = allLi[i]; 
        li.src = "images/bannerImg" + (i+1) + ".webp"
    }
 }
    // 3、动态添加icon
    function addIcon(){
        var parents = $('bottom')
        var allLis = parents.getElementsByTagName('span')
        console.log('ee')
        for (var i = 0; i < allLis.length; i++){
            console.log(i)
            var li = allLis[i];
            li.style.background = "url('images/right.png') no-repeat 0 -"+i*44+"px"
        }
    }

    // 自定义动画


function $(id){
    return typeof id === "string" ? document.getElementById(id): null;
}
